#coding=utf-8
import configparser
#创建configParser对象
cf = configparser.ConfigParser()
#read(filename)：读文件内容
filename = cf.read("config.ini",encoding='utf-8')
print(filename)
#sections():得到所有的Section，以列表形式返回
sec = cf.sections()
print(sec)
#options(section):得到Section下的所有option
opt = cf.options("EMAIL")
print(opt)
#items:得到Section的所有键值对
value = cf.items("EMAIL")
print(value)
#get(section,option):得到Section中的option值，返回string/int类型的结果
email_host = cf.get("EMAIL","mail_host")
email_password = cf.get("EMAIL","mail_pass")
email_sender = cf.get("EMAIL","sender")
email_user = cf.get("EMAIL","mail_user")